﻿using Commonality.ReturnView;
using IService.PlatApi;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ModelToDto.PlatAPI;

namespace PlatAPI.Controllers
{

    public class RegisterController : BaseController
    {
  
        ILoginVerification loginVerification { get; set; }
        /// <summary>
        ///  验证码验证，登录验证
        /// </summary>
        public RegisterController(ILoginVerification loginVerification) 
        {
           this.loginVerification = loginVerification;
        }
        /// <summary>
        /// 发送验证码
        /// </summary>
        /// <param name="phoneNum"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult SendVerifyCode([FromQuery] string phoneNum)
        {
          return  loginVerification.VerifCode(phoneNum);
        }
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <param name="regiesteUserDTO"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult RegiestPhoneNum([FromBody] RegiesteUserDTO regiesteUserDTO)
        {
            return loginVerification.RegiestPhoneNum(regiesteUserDTO);
        }
    }
}
